<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .pop_main {
            display: none;
        }

        .pop_con {
            width: 500px;
            height: 300px;
            background: #fff;
            border-radius: 4px;
            position: fixed;
            left: 50%;
            top: 50%;
            margin-left: -250px;
            margin-top: -150px;
            border: 1px solid #f0f0f0;
            z-index: 9999;
        }

        .pop_title {
            width: 490px;
            height: 40px;
            background: #157bef;
            margin: 5px auto 0;
            border-radius: 6px;
        }

        .pop_title h3 {
            float: left;
            margin: 0px;
            margin-left: 10px;
            line-height: 40px;
            color: #fff;
            font-size: 18px;
            font-weight: normal;
        }

        .pop_title a {
            float: right;
            width: 20px;
            height: 20px;
            background: #fff;
            margin: 10px 10px 0 0;
            text-decoration: none;
            line-height: 20px;
            text-align: center;
            font-size: 20px;
            border-radius: 4px;
        }

        .pop_detail {
            height: 200px;
            border-bottom: 1px solid #f0f0f0;
            /* 解决margin-top塌陷 */
            overflow: hidden;
        }

        .pop_footer {
            height: 54px;
            line-height: 54px;
            text-align: center;
            color: #666;
        }

        .pop_footer span {
            color: red;
            padding: 0 5px;
        }

        .mask {
            width: 100%;
            height: 100%;
            background: #000;
            position: fixed;
            left: 0;
            top: 0;
            opacity: 0.3;
            /*兼容低版本ie*/
            filter: alpha(opacity=30);
            z-index: 9990;
        }

        .pop_text {
            margin: 74px 0 0 100px;
            font-size: 20px;
            color: #666;
        }
    </style>
    <script src="./js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript">
        $(function () {

            $('#btn01').click(function () {
                // 点击显示弹出框
                $("#pop").show();
                console.log("show");
                return false;
            });

            $(document).click(function () {
                // 点击整个文档都消失
                $("#pop").hide();
                console.log("hide");
            });

            $(".pop_con").click(function () {
                // 阻止弹框部分的点击传递
                return false;
            });

            // 点击x消失
            $("#shutoff").click(function () {
                $("#pop").hide();
            });

        })
    </script>
</head>

<body>
    <input type="button" value="弹出弹框" id="btn01">
    <div class="pop_main" id="pop">

        <div class="pop_con">
            <div class="pop_title">
                <h3>系统提示</h3>
                <a href="#" id="shutoff">×</a>
            </div>
            <div class="pop_detail">
                <p class="pop_text">亲！请关注近期的优惠活动！</p>
            </div>
            <div class="pop_footer">

            </div>
        </div>

        <div class="mask"></div>

    </div>
</body>

</html>